/* 充值奖励大转盘 */
var head = "#fUI/UIWindow2.img/Quest/quest_info/summary_icon/summary#\r\n";
var icon = "#fUI/UIWindow2.img/QuestAlarm/BtQ/normal/0#";
var icon2 = "#fUI/UIToolTip.img/Item/Equip/Star/Star#";

var status = -1;

function action(mode, type, selection) {
    if (mode == 1) {
        status++;
    } else {
        if (status == 0) {
            cm.dispose();
        }
        status--;
    }
    if (status == 0) {
        if ((cm.getSpace(1) > 1 || cm.getSpace(2) > 1 || cm.getSpace(3) > 1 || cm.getSpace(4) > 1) && cm.getHyPay(4) >= 30) {
            cm.sendYesNo(head + "这里是充值抽奖专区。我背包里面包含了必成卷轴、大PB、椅子、永恒、140所有装备哦。如果你充值幻币满了30可以再这里免费抽奖一次哦！你确定要抽奖吗？");
        } else {
            cm.sendOk(head + "你充值幻币总数到30了吗？");
            cm.safeDispose();
        }
    } else if (status == 1) {
        if (cm.delPayReward(30) > 0) {
            var item;
            var chance = Math.floor(Math.random() * 30);
            if (chance >= 0 && chance <= 8) {
                cm.gainExp( + 500000000);
                cm.sendOk("恭喜你获得了5E经验值。");
                cm.worldMessage("恭喜玩家" + cm.getChar().getName() + "在充值大转盘(30面值)中吸5E经验。");
                cm.dispose();
				return;
            } else if (chance >= 9 && chance <= 18) {
                cm.gainMeso( + 666666);
                cm.sendOk("恭喜你获得了66W金币。");
                cm.worldMessage("恭喜玩家" + cm.getChar().getName() + "在充值大转盘(30面值)中无意拿到66W支票。");
                cm.dispose();
				return;
            } else if (chance >= 19 && chance <= 28) {
                var itemList = new Array(3010000, 3010001, 3010002, 3010003, 3010004, 3010005, 3010006, 3010209, 3010210, 3010007, 3010008, 3010009, 3010013, 3010014, 3010016, 3010017, 3010295, 3010018, 3010019, 3010021, 3010024, 3010028, 3010029, 3010030, 3010031, 3010034, 3010035, 3010036, 3010037, 3010038, 3010043, 3010041, 3010044, 3010046, 3010047, 3010048, 3010049, 3010050, 1092074, 1092079, 1092084);
                item = cm.gainGachaponItem(itemList[Math.floor(Math.random() * itemList.length)], 1, "充值大转盘(30)");
            } else {
                var itemList = new Array(2040303, //耳环智力必成卷
                2040006, //头盔防御必成卷
                3010070, //巨无霸椅子
                2040007, //头盔体力必成卷
                2040403, //上衣防御必成卷
                2040506, //全身盔甲敏捷必成卷
                2040507, //全身盔甲防御必成卷
                2040603, //裤裙防御必成卷
                2040507, //全身盔甲防御必成卷
                2040603, //裤裙防御必成卷
                2040709, //鞋子敏捷必成卷
                2040710, //鞋子跳跃必成卷
                2040711, //鞋子速度必成卷
                2040806, //手套敏捷必成卷
                2040903, //盾牌防御必成卷
                2040507, //全身盔甲防御必成卷
                2040603, //裤裙防御必成卷
                2041024, //披风魔法防御必成卷
                2041025, //披风物理防御必成卷
                2043003, //单手剑攻击必成卷
                2044019, //双手剑魔力必成卷
                2044019, //双手剑魔力必成卷
                2043103, //单手斧攻击必成卷
                2043203, //单手钝器攻击必成卷
                2043303, //短剑攻击必成卷
                2043703, //短杖攻击必成卷
                2043803, //长杖攻击必成卷
                2044003, //双手剑攻击必成卷
                2044019, //双手剑魔力必成卷
                2044103, //双手斧攻击必成卷
                2040903, //盾牌防御必成卷
                2040903, //盾牌防御必成卷
                2044203, //双手钝器攻击必成卷
                2044303, //枪攻击必成卷
                2044403, //矛攻击必成卷
                2044503, //弓攻击必成卷
                2044603, //弩攻击必成卷
                2044703, //拳套攻击必成卷
                2044815, //指节攻击必成卷
                2044908, //短枪攻击必成卷
                2340000, //祝福卷轴
                2049406, //特殊潜能附加卷轴
                2049303, //高级装备强化卷轴
                3010070, //巨无霸品克缤
                3010073, //baby品克缤
                3010073, //baby品克缤
                1402014, //温度计
                1003172, //狮心战斗头盔
                1102275, //狮心战斗披风
                1082295, //狮心战斗护腕
                1052314, //狮心战斗锁子甲
                1072485, //狮心战斗鞋
                1003173, //龙尾法师帽子
                1102276, //龙尾法师披风
                1082296, //龙尾法师手套
                1052315, //龙尾法师长袍
                1072486, //龙尾法师鞋
                1003174, //鹰翼哨兵便帽
                1102277, //鹰翼哨兵披风
                1082297, //鹰翼哨兵手套
                1052316, //鹰翼哨兵服
                1072487, //鹰翼哨兵鞋
                1003175, //渡鸦之魂追踪者帽
                1102278, //渡鸦之魂猎人披风
                1082298, //渡鸦之魂追踪者手套
                1052317, //渡鸦之魂追踪者盔甲
                1072488, //渡鸦之魂追踪者鞋
                1003176, //鲨齿船长帽
                1102279, //鲨齿船长披风
                1082299, //鲨齿船长手套
                1052318, //鲨齿船长外套
                1072489, //鲨齿船长鞋
                1432086, //狮心长枪
                1442116, //狮心长矛
                1322096, //狮心震雷
                1422066, //狮心巨锤
                1402095, //狮心战刀
                1412065, //狮心战斧
                1302152, //狮心弯刀
                1312065, //狮心勇斧
                1372084, //龙尾短杖
                1382104, //龙尾长杖
                1452111, //鹰翼重弓
                1462099, //鹰翼重弩
                1332130, //渡鸦之魂（短刀）
                1472122, //渡鸦之魂
                1342036, //精灵角刀
                1492085, //鲨齿手铳
                1532018, //鲨齿鹰爪
                1302016, //鲨齿火炮
                1522018 //龙翼弩枪
                );
                item = cm.gainGachaponItem(itemList[Math.floor(Math.random() * itemList.length)], 1, "充值大转盘(30)");
            }
            if (item != -1) {
                cm.sendOk("你获得了 #b#t" + item + "##k.");
            } else {
                cm.sendOk(head + "你确实充值幻币总数到30了吗?如果是,请你确认在背包的装备,消耗,其他窗口中是否有一格以上的空间?");
            }
        } else {
            cm.sendOk("xx错误");
        }
        cm.safeDispose();
    }
}